UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kP9LMoV5vONpTeQinewQ/nCkFusWpmUUnfEk/M5DlEw='
WHERE
key_id = 'e516795b7e2ebb882ea92b2e6606d55d10cdf49333f140967ebb6248ec9dc31e'
AND (
token = 'kP9LMoV5vONpTeQinewQ/nCkFusWpmUUnfEk/M5DlEw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)