UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd8e9wJCdjyrBrZWxIS9rxayWNsx4of1632X9pb+l694='
WHERE
key_id = 'f3eb70e96b5a36c56e0a2d32029c067b4e3ee1e0dec2f5cd83831b9a0f909ebb'
AND (
token = 'd8e9wJCdjyrBrZWxIS9rxayWNsx4of1632X9pb+l694='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)