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

Query time 0.00036