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