UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rfOlfvMAwnsmedUqySuhYnrUcELpHbZPvS8e7iM8LPA='
WHERE
key_id = 'd3447b3dba6c34d793c0a6b1473f7f04339c8e89da06d21b949f60680f16adc6'
AND (
token = 'rfOlfvMAwnsmedUqySuhYnrUcELpHbZPvS8e7iM8LPA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)