UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yaN+VOpDIEviOIE3jAwLABqmIO8UwE0WwFHl56n/37Q='
WHERE
key_id = 'a1eed5c6d7286e6d499bc4adc5129246d950e4a32930a5a7a6565fd987f37b11'
AND (
token = 'yaN+VOpDIEviOIE3jAwLABqmIO8UwE0WwFHl56n/37Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)