UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KWc8cAQLgvHJMZGvwlUasUsvpbxWw655bmtFjGS+gDM='
WHERE
key_id = 'f46131ca6655e2b6d15fab04bf0d5f126ae0ce5929701319907b1769d8e2b4cd'
AND (
token = 'KWc8cAQLgvHJMZGvwlUasUsvpbxWw655bmtFjGS+gDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)