UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd3A/s+TTcRqnenoKm997oqq/aC1fTRjQjA/lQkc4fDs=' 
WHERE 
  key_id = '1c827eb2d0cbcbf05bfbae299637263eaf399843492b92a3851e9d1f45247723' 
  AND (
    token = 'd3A/s+TTcRqnenoKm997oqq/aC1fTRjQjA/lQkc4fDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024