UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fLeQgP3P4Fj+JKrh5VDxb5KfZFQZN8gRFA03dzcuock='
WHERE
key_id = '0f4b88052cef049d4ec95a2a7577990c1ed2ba7eb165c048de377caa856743bc'
AND (
token = 'fLeQgP3P4Fj+JKrh5VDxb5KfZFQZN8gRFA03dzcuock='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)