UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sPLyQRbS14rjKXQXNxR63GrJnhWgYfrrqRaqcX9WvfI='
WHERE
key_id = '5d81869fc239579698e6f3e401e3d75fc2082684201f7d177d8ea98113602a1a'
AND (
token = 'sPLyQRbS14rjKXQXNxR63GrJnhWgYfrrqRaqcX9WvfI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)