UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y3IeH8fAdtdXVuVVidNx72dwHa8E55708QjcE3+YfPY='
WHERE
key_id = 'c8b93afc6bd345374f3f8d023025fc7215489c7df3b242a56b844d36b5fb4a07'
AND (
token = 'Y3IeH8fAdtdXVuVVidNx72dwHa8E55708QjcE3+YfPY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)