UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KgmL6Iyc5wE7uBPoxCZYqZ3V3iXHvivGZK9ykZdemfY='
WHERE
key_id = 'e904009e0600e2de765590472cde6f95c9731dff00ca2c3b9912c02a4fad90bc'
AND (
token = 'KgmL6Iyc5wE7uBPoxCZYqZ3V3iXHvivGZK9ykZdemfY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)