UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sTREyAz+DtE5pNUoAl20V0FXTc6nY992hIfiMjfAcL8='
WHERE
key_id = '741696ef6914d301d847eb550ffb96c0adf5505246a6b0f4c77d8e290d59c748'
AND (
token = 'sTREyAz+DtE5pNUoAl20V0FXTc6nY992hIfiMjfAcL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)