UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u4aBW0piiDWbgRbqmW8+mZdHZlG6AL6xCILzaBChwG0='
WHERE
key_id = 'a6d4fb2b1215366cf3c5ed17a877e83341e9d6a698683f04c3d6ae91b46565ea'
AND (
token = 'u4aBW0piiDWbgRbqmW8+mZdHZlG6AL6xCILzaBChwG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)