UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xO5mQBWy5rkVUr4NzT/IsXPp90Gvf1sD53q4r3W4Yvw=' 
WHERE 
  key_id = 'c0673867c4453f8941c92f9303886a409edc4d7a3d27b9bc0e748849bcf9057a' 
  AND (
    token = 'xO5mQBWy5rkVUr4NzT/IsXPp90Gvf1sD53q4r3W4Yvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026