UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cr3PGgTDScG7TvVoZPSVNX4uLc3RlrKjvG3QsSxfIHk='
WHERE
key_id = '370db8019aa3d4108eed235f3ef25dfb929692450ef6b39b05be9e5c0f3a87d5'
AND (
token = 'cr3PGgTDScG7TvVoZPSVNX4uLc3RlrKjvG3QsSxfIHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)