UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gcJ3lUdhcAXRACOWl2xaODQW+NYKXPRF0Fe4tbC5AhM='
WHERE
key_id = '604249b4f3a06a74f4f03430aae6f60ced34f514f806c051b0daef093215b2ea'
AND (
token = 'gcJ3lUdhcAXRACOWl2xaODQW+NYKXPRF0Fe4tbC5AhM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)