UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yPXztJneneNH0AucPd3PY5QVwRlAEn8q6zCPuyI2w5k=' 
WHERE 
  key_id = 'e78b2d0e45f187067577bfd5e80d494c1078837e4021af5404f72305c4f6647d' 
  AND (
    token = 'yPXztJneneNH0AucPd3PY5QVwRlAEn8q6zCPuyI2w5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033