UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T042OacJUPyuafxjeZpe5Laz8jI1VoZiAcJbsMcSVeg=' 
WHERE 
  key_id = '6be13e1a3c84783795093d85c510a14a9122171fa39b85f2eca2c3550ce4473c' 
  AND (
    token = 'T042OacJUPyuafxjeZpe5Laz8jI1VoZiAcJbsMcSVeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034