UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YKw+SRtrGKNjZ+w8+ZwLI/q+9xn+1Jruzr02oQIC8qE='
WHERE
key_id = 'a47edd89ee5e6963a14d574b8035423559bdb11e6439c7f13cb6acf1ea974bc1'
AND (
token = 'YKw+SRtrGKNjZ+w8+ZwLI/q+9xn+1Jruzr02oQIC8qE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)