UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1aU6E1FwsaZvt8BIJHSMTV4DLY3cRoNE8w2tAD6z9L8='
WHERE
key_id = 'd8eb16ecab25f893758d8ba5a2a66ad08616ed61eb152b0a273b559cd48f1867'
AND (
token = '1aU6E1FwsaZvt8BIJHSMTV4DLY3cRoNE8w2tAD6z9L8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)