UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pZqVv4f4liM6kV2dlMdD5ShmeoksKIcAFr0RBasKo2A=' 
WHERE 
  key_id = '77bbf6135371299f0c0acd47bd700673a19736c800807b4e674103bd205867c7' 
  AND (
    token = 'pZqVv4f4liM6kV2dlMdD5ShmeoksKIcAFr0RBasKo2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046