UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n8Yke1bXacIB9KCOBxb4quoXlzVuc4JagF3xqCtEK+M='
WHERE
key_id = 'e51c8431e5b980c506fe3d3a6bc7f9779e03bd44be5a8836f56cd8c96340823a'
AND (
token = 'n8Yke1bXacIB9KCOBxb4quoXlzVuc4JagF3xqCtEK+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)