UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A2sdUzp2MG4XmWJ7s/2i1LYEazEBxCMUU+C4Kntj5Kk='
WHERE
key_id = 'fa1bb00ddc12ee4cb4c9357840ee939102d507b0ad95484e0c5b5a736f860d4d'
AND (
token = 'A2sdUzp2MG4XmWJ7s/2i1LYEazEBxCMUU+C4Kntj5Kk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)