UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Cy3h21pTsMrJE5lpA76cqC5u4Ge+RFSmfyvYJLuiW8='
WHERE
key_id = 'aeacf36cb24c3bd07792893c395e71999b7a517cfa7b4656f75d13867ea5ef15'
AND (
token = '3Cy3h21pTsMrJE5lpA76cqC5u4Ge+RFSmfyvYJLuiW8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)