UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oHMXUmSadA6CztxtgZjxSHhHrsVb3sU5rztX8jBbN6k='
WHERE
key_id = '653aa411c6b61e34273770a1e988e8a12889e8e1516839cff44236ab874947b6'
AND (
token = 'oHMXUmSadA6CztxtgZjxSHhHrsVb3sU5rztX8jBbN6k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)