UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZDewjf/Amzx0T3zybhZeukpm04dADz4xX5Wv31vJ8LA='
WHERE
key_id = 'e428cac164d60d902b4f01df93b11173e3050471a1afe86b60c1a0e06e984a14'
AND (
token = 'ZDewjf/Amzx0T3zybhZeukpm04dADz4xX5Wv31vJ8LA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)