UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wH3ZN2+UBQVYWrFrC40u7XC9A5/fsMNAGvFMiUfjJn0=' 
WHERE 
  key_id = '3a34781d2067abc61ccb0a75e712d129c13fc068bf3894dbe2d09febd2b04d34' 
  AND (
    token = 'wH3ZN2+UBQVYWrFrC40u7XC9A5/fsMNAGvFMiUfjJn0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027