UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SOg5wUjdnAZHxwguEYZphqNa3E5H4quTZ+3xP8zwC7o='
WHERE
key_id = 'b7a1a09d63aa126b5bc743be026ec597e3a2e54be9f5cb486edd57affa5f8e28'
AND (
token = 'SOg5wUjdnAZHxwguEYZphqNa3E5H4quTZ+3xP8zwC7o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)