UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mmbOyS9cJZnyKvQ+BELJVvroURKvSxbLubowS501pNk='
WHERE
key_id = 'fe65eeb519fea17a7e95884bafd9d2ef422454cb7659ac25844735856ae0240e'
AND (
token = 'mmbOyS9cJZnyKvQ+BELJVvroURKvSxbLubowS501pNk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)