UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'misQ9J33eDdZ6U8VAccCkqDo0GNelzix5sZMyou9KXw='
WHERE
key_id = '5810ce880af1a78b0a24f6af12a3f705802285cdf1c2862b96aa1ebb90354e00'
AND (
token = 'misQ9J33eDdZ6U8VAccCkqDo0GNelzix5sZMyou9KXw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)