UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kRhil6BHssQOHr28zIjmq6AcbYu1/8UWxwxUbwO1Uyw='
WHERE
key_id = '5bf9d2ff5493ed43c1eebcfc09674f42e62f4db6900b84a360191549fbb0a66b'
AND (
token = 'kRhil6BHssQOHr28zIjmq6AcbYu1/8UWxwxUbwO1Uyw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)