UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wgt7TBCruZS59pLK6yoKqHtSRhAvIK+fEsbPGjtmWOU=' 
WHERE 
  key_id = 'a2dde3f1a9b9d2d79dd438068d16ec929e317b40b7b5213a12650297b33bb3fa' 
  AND (
    token = 'wgt7TBCruZS59pLK6yoKqHtSRhAvIK+fEsbPGjtmWOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036